package com.timesheet.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.base.common.persistence.utils.SqlMapper;
import com.base.common.service.CrudService;
import com.timesheet.dao.TimesheetMapper;
import com.timesheet.model.Timesheet;
import com.timesheet.service.TimesheetService;

@Service
public class TimesheetServiceImpl extends CrudService<TimesheetMapper, Timesheet> implements TimesheetService {

	@Autowired
	private TimesheetMapper timesheetMapper;
	@Autowired
	SqlMapper sqlMapper;
	
	@Override
	public void saveTimesheet(Timesheet timesheet) {
		
		this.saveOrUpdate(timesheet);
	}
	
	public void saveTimesheet(List<Timesheet> timesheets){
		this.batchSave(timesheets);
	}
	
	public List<Timesheet> findByDateAndUser(Timesheet timesheet) {
		List<Timesheet> list = timesheetMapper.selectChByModel(timesheet);
		return list;
	}
	
	public List<Timesheet> findTimesheetList(Timesheet timesheet) {
		List<Timesheet> list = timesheetMapper.findList(timesheet);
		
		return list;
	}
}
